package com.cyz.repository;


import java.util.Date;

import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RestResource;

import com.vsd.domain.UserCoupon;

@RestResource(exported = false)
public interface UserCouponRepository extends CrudRepository<UserCoupon, String> {
	
	UserCoupon findByCouponIdAndUserId(String couponId,String userId);
	
	UserCoupon findByCouponIdAndUserIdAndCreateTimeBetween(String couponId,String userId,Date begin,Date end);
	
	int countByUserIdAndCouponId(String userId,String couponId);
	
	int countByUserIdAndCouponIdAndCreateTimeBetween(String userId,String couponId,Date begin,Date end);
	
	int countByUserIdAndCouponIdAndState(String userId,String couponId,Integer state);
	
}
